cmake_minimum_required(VERSION 3.6)
project(ServerGeeJoan)

include_directories(Server)

# 协议库
set(PROTOCOL_SRC_LIST
        GeeJoan/NetWorkPackage.pb.cc
        GeeJoan/AuthModule.pb.cc
        GeeJoan/ErrorModule.pb.cc
        GeeJoan/IoTModule.pb.cc)


add_library(GeeJoanProtocol STATIC ${PROTOCOL_SRC_LIST} )

target_link_libraries(GeeJoanProtocol
        PRIVATE
        protobuf::libprotobuf
        )

add_library(${PROJECT_NAME}
        OBJECT
        Server/BaseServer.cpp
        Server/SingleServer.cpp
        Server/ServerContext.cpp
        Business/AuthBusiness.cpp
        Business/IoTBusiness.cpp
        Business/BaseBusiness.cpp
        Business/CacheManager.cpp
        Business/EventManager.cpp
        Business/DataBase/DataBaseHelper.cpp
        Business/DataBase/UserDataBaseFactory.cpp
        Business/DataBase/IoTDataBaseFactory.cpp
        Tools/CommonTool.cpp
        Tools/GeeJoanMD5.cpp
        )
MESSAGE(STATUS "test ${PROTOBUF_LIBRARIES}")
target_link_libraries(
        ${PROJECT_NAME}
        PRIVATE
        GeeJoanProtocol
        SQLiteCpp
        handy_s
)

#

INSTALL(TARGETS
        GeeJoanProtocol
        EXPORT GeeJoan-targets
        RUNTIME DESTINATION ${GEEJOAN_OUTPUTDIR}/GeeJoan/bin
        LIBRARY DESTINATION ${GEEJOAN_OUTPUTDIR}/GeeJoan/libs
        ARCHIVE DESTINATION ${GEEJOAN_OUTPUTDIR}/GeeJoan/libs)

include(install_header.cmake)